package com.icss.OA.service.impl;

import com.icss.OA.dao.CarMapper;
import com.icss.OA.pojo.Car;
import com.icss.OA.service.CarService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
public class CarServiceImpl implements CarService {
    @Autowired
    CarMapper carMapper;

    @Transactional
    @Override
    public void add(Car car) {

        carMapper.insertSelective(car);
    }

    @Override
    public List<Car> findAll() {
        return carMapper.selectAll();
    }

    @Transactional
    @Override
    public void update(Car car) {
        carMapper.updateByPrimaryKeySelective(car);
    }

    @Override
    public void removeCarByCarNo(String... carNos) {
        carMapper.deleteByPrimaryKeyS(carNos);
    }
}
